package com.cloud.pora.mrm.web;

import javax.persistence.EntityManager;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.log.Log;

import com.cloud.pora.mrm.model.MeetingRoom;
import com.cloud.pora.mrm.model.MeetingRoomBooking;

@Name("meetingRoomAction")
public class MeetingRoomAction {

    @Logger
    private Log log;

    @In(required = false)
    private MeetingRoom meetingRoom;

    @In
    EntityManager entityManager;

    /*
     * @Out private MeetingRoom meetingRoom;
     * 
     * @In EntityManager entityManager;
     * 
     * 
     * @DataModelSelection("meetingRoomSel") private MeetingRoom meetingRoomSel;
     * 
     * public void page() { log.info("find mrId is #0", meetingRoom.getMrId());
     * this.meetingRoom = entityManager.find(MeetingRoom.class,
     * meetingRoom.getMrId()); }
     * 
     * public String confirm() { log.info("selected mrId is #0",
     * meetingRoomSel.getMrId()); Context conversationalConvContext =
     * Contexts.getConversationContext();
     * conversationalConvContext.set("meetingRoomSel", meetingRoomSel); return
     * "confirm"; }
     */

    public String create() {
        meetingRoom.setInsertId("admin");
        entityManager.persist(meetingRoom);
        return "create_success";
    }

    public String update() {
        meetingRoom.setUpdateId("admin");
        return "update_success";
    }

    public String delete() {
        entityManager.remove(meetingRoom);
        return "delete_success";
    }

    public String deleteView() {
        return "delete_view";
    }

    public String booking() {
        return "booking";
    }

    public void page() {
        boolean initFlag = false;
        initFlag = true;

    }
}
